package com.itwn.comic.mapper;

import com.itwn.comic.entity.Manager;
import com.itwn.comic.vo.ManagerVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ManagerMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ManagerVo managerVo);

    Manager selectByPrimaryKey(Long id);

    List<Manager> selectAll();

    int updateByPrimaryKey(ManagerVo managerVo);

    // -- 管理员的登录查询方法
    @Select("select * from t_manager where name = #{name}")
    Manager selectManagerByName(String name);

    // -- 管理员的显示方法
    List<ManagerVo> selectManagerByPage(String name);

    @Delete("delete from t_manager_role where manager_id = #{id}")
    void deleteRoleByManagerId(Long id);

    void insertManagerAndRole(@Param("list") List<Integer> list, @Param("mid") Long id);

    int insertManager(ManagerVo managerVo);
}